//
//  HRCommonData.h
//  haierapp
//
//  Created by zhang on 14-8-7.
//  Copyright (c) 2014年 haier. All rights reserved.
//

#import <Foundation/Foundation.h>

#import "HRUser.h"
#import "HROrderList.h"
#import "HRGoodsInfo.h"
#import "HRProductInfo.h"

typedef void (^UserManagerBlock)(BOOL isSucceed, NSString *message);


@interface HRCommonData : NSObject

@property(nonatomic,strong) HRUser *curUser;//当前登录用户
@property(nonatomic,strong) HROrderList *orderList;//获取的订单列表

@property(nonatomic,assign) BOOL hasNewOrder;//是否有新的订单数据
@property(nonatomic,assign) BOOL hasNewShopCar;//购物车是否有新的商品
@property(nonatomic,assign) BOOL isUserScoreChanged;//用户积分

@property(nonatomic,assign) double appStartTime;//app启动时间

@property (nonatomic, strong) UserManagerBlock loginCompleteBlock;

+(HRCommonData *)shareCommonData;

//从存储库中，获取登录用户
-(HRUser *)getLoginUserFromDefaults;

//将用户数据存储到Defaults
-(void)loginUser:(HRUser *)user;

//用户退出
-(void)logout;

//获取服务器最新的数据标示
-(void)setDataHasNew;

#pragma mark - 未登陆购物车操作

//添加购物车
-(void)addProductToShopCar:(HRGoodsInfo *)goodsInfo andProductId:(NSString *)productId;

//从购物车删除
-(void)deleteProductFromShopCar:(NSString *)goodsId;

//清除购物车数据
-(void)clearProductsFromShopCar;

//本地缓存购物车产品的数量
-(int)CountProductInShopCar;


#pragma mark - UUID
//获取UUID
-(NSString *)getDeviceUUID;

@end
